

cc.Class({
    extends: cc.Component,

    properties: {

    },

    onLoad() {
        this.card = null;
    },

    setCard(card) {
        card.node.parent = this.node;

        card.position = cc.p(0, 0);
        card.scale = this.node.height / card.height;

        card.isHold = true;
        this.card = card;
    },
    removeCard() {
        let card = this.card;
        card.node.removeFromParent();

        card.scale = 1;

        card.isHold = false;
        this.card = null;

        return card;
    },

    isEmpty() {
        return this.card == null;
    },


    containsPoint(p) {
        p = this.node.parent.convertToNodeSpaceAR(p);

        return cc.rectContainsPoint(this.node.getBoundingBox(), p);
    }
});
